package com.itheima.controller;

import com.itheima.pojo.Category;
import com.itheima.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class CategoryController {


    @Autowired
    private CategoryService categoryService;

    @RequestMapping(value = "/findCategory",method = RequestMethod.POST)
    @ResponseBody
    public List<Category> findCategory(){


        List<Category> categoryList = categoryService.findAll();
        return categoryList;
    }
}
